package cn.edu.scau.cmi.lixiaoyuan.composite.safe;

import java.util.HashSet;
import java.util.Set;

import cn.edu.scau.cmi.lixiaoyuan.composite.consistent.ConsistentOrganization;
import cn.edu.scau.cmi.lixiaoyuan.composite.consistent.Person;

public class SafeTeam extends SafeOrganization{
	private String name;
	
	public SafeTeam(String name) {
		super();
		this.name = name;
		
	}

	public Set<SafePerson> safePersons = new HashSet<SafePerson>();
  
	public Set<SafeTeam> safeTeams = new HashSet<SafeTeam>();
	
	
	
	public void addPerson(SafePerson person,SafeTeam team) {
		team.safePersons.add(person);
		person.setKongge(team.getKongge()+2);
	}
	
	public void addTeam(SafeTeam team) {
		safeTeams.add(team);
		team.setKongge(this.kongge+2);
	}

    public int kongge=0;
	
	public int getKongge() {
		return kongge;
	}

	public void setKongge(int kongge) {
		this.kongge = kongge;
	}

	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public void doSomething() {
		// TODO Auto-generated method stub
		for(int i=0;i<this.getKongge();i++)
			System.out.print(" ");
//		System.out.println(this.name);
		for(Object obj : safeTeams) {
			System.out.println(((SafeTeam)obj).getName());
			((SafeTeam)obj).doSomething();
			for(Object obj1 : ((SafeTeam)obj).safePersons) {
				((SafePerson)obj1).doSomething();
			}
		}
		
	}

	
	
	
	
	

}
